package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 点巡检计划对象 MB_ERP_EQUIPMENT_UPKEEP_PLAN
 *
 * @author Cheng
 * @date 2023-07-19
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_UPKEEP_PLAN")
@Schema(description="点巡检计划")
public class EquipmentUpkeepPlan extends BaseEntity {

private static final long serialVersionUID=1L;

    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_")
    @Schema(description = "主键")
    private String id;

    @Column(name = "CODE_")
    @Schema(description = "计划编码")
    private String code;

    @Column(name = "NAME_")
    @Schema(description = "计划名称")
    private String name;

    @Column(name = "TARGET_TYPE_")
    @Schema(description = "目标类型")
    @Dict(dicCode = "ERP_EQUIPMENT_TASK_TARGET_TYPE")
    private String targetType;

    @Column(name = "START_TIME_")
    @Schema(description = "起始时间")
    private String startTime;

    @Column(name = "START_TIEM_UNIT_")
    @Schema(description = "起始时间单位")
    @Dict(dicCode = "ERP_EQUIPMENT_TASK_RATE_UNIT")
    private String startTiemUnit;

    @Column(name = "RATE_")
    @Schema(description = "频率")
    private String rate;

    @Column(name = "RATE_UNIT_")
    @Schema(description = "频率单位")
    @Dict(dicCode = "ERP_EQUIPMENT_TASK_RATE_UNIT")
    private String rateUnit;

    @Column(name = "IS_ENABLE_")
    @Schema(description = "是否启用")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isEnable;

    @Column(name = "IS_AUTO_")
    @Schema(description = "是否自动下达")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isAuto;

    @Column(name = "ADVANCE_TIME_")
    @Schema(description = "提前下达时间(分钟)")
    private Integer advanceTime;

    @Column(name = "RELEASE_TARGET_TYPE_")
    @Schema(description = "下达目标类型")
    @Dict(dicCode = "ERP_EQUIPMENT_RELEASE_TARGET_TYPE")
    private String releaseTargetType;

    @Column(name = "TARGET_")
    @Schema(description = "下达目标id")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String target;

    @Column(name = "TARGET_NAME_")
    @Schema(description = "下达目标")
    private String targetName;

    @Column(name = "DISPATCH_MODE_")
    @Schema(description = "派工模式")
    @Dict(dicCode = "ERP_EQUIPMENT_DISPATCH_MODE")
    private String dispatchMode;

    @Column(name = "LAST_PLAN_START_")
    @Schema(description = "上次计划开始时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastPlanStart;

    @Column(name = "LAST_PLAN_END_")
    @Schema(description = "上次计划结束时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastPlanEnd;

}
